<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js操作单一dom节点</title>
</head>
<body>
<div id="message" class="box" name="messageBox"></div>
<input id="username" value="add"/>
</body>
<script>
    /*1选择器和插值*/

    /*id选择器*/
    var box = document.getElementById('message');
    box.innerText = "hello u";

    /*类选择器*/
    var box2 = document.getElementsByClassName('box')[0]; // getElementsByClassName 返回一个集合
    box2.innerText = "box2";

    /*元素选择器*/
    var box3 = document.getElementsByTagName('div')[0]; // getElementsByTagName 返回一个集合
    box3.innerText = "<h1>box3</h1>";
    //box3.innerHTML="<h1>box3-html</h1>";

 /*   /!*name选择器*!/
    var box4 = document.getElementsByName('messageBox')[0]; // getElementsByTagName 返回一个集合
    box3.innerText = "box4";*/

    var username = document.getElementById('username');
  //  username.value = "admin";



</script>
</html>